package com.ruoyi.web.xxj.service;

import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.JSONWriter;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.WechatUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.web.xxj.domain.ClassOrder;
import com.ruoyi.web.xxj.domain.PaymentInfo;
import com.ruoyi.web.xxj.domain.ProductOrder;
import com.ruoyi.web.xxj.domain.RefundInfo;
import com.ruoyi.web.xxj.domain.pojo.PrePayReq;
import com.ruoyi.web.xxj.domain.pojo.WxPayV3Bean;
import com.ruoyi.web.xxj.enums.Constants;
import com.ruoyi.web.xxj.service.impl.*;
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
import com.wechat.pay.java.core.exception.HttpException;
import com.wechat.pay.java.core.exception.MalformedMessageException;
import com.wechat.pay.java.core.exception.ServiceException;
import com.wechat.pay.java.core.exception.ValidationException;
import com.wechat.pay.java.core.notification.NotificationParser;
import com.wechat.pay.java.core.notification.RequestParam;
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
import com.wechat.pay.java.service.payments.jsapi.model.Payer;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
import com.wechat.pay.java.service.payments.model.Transaction;
import com.wechat.pay.java.service.refund.RefundService;
import com.wechat.pay.java.service.refund.model.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;

@Service
public interface IWxPayService {

    public AjaxResult prePay(PrePayReq prePayVo) throws Exception;

    public ResponseEntity<Void> notify(HttpServletRequest request, String body);

    public int refund(ClassOrder classOrder);

    public int refund(ProductOrder productOrder);

    public ResponseEntity<Void> refundNotify(HttpServletRequest request, String body);

    AjaxResult prePayByOrder(String orderNo, String type) throws Exception;
}
